﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Common.Swaggers;
using System.Text;

/// <summary>
/// 作者:$username$
/// 时间:$time$
/// 机器名:$machinename$
/// 项目名:$projectname$
/// </summary>

namespace $projectname$.Controllers
{
 

    ///测试接口
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    //swagger模块
    [ApiExplorerSettings(GroupName = SwaggerGroupingModel.GroupName_Test)]
    public class $projectname$Controller : Controller
    {
        /// <summary>
        /// 测试  无需登录，可访问
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public string $projectname$Login()
        {
            return "无需登录，可访问";
        }

        /// <summary>
        ///测试 需要登录权限访问接口
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Authorize]
        public string $projectname$TrueLogin()
        {
            return "只要登录就可以访问";
        }

        /// <summary>
        /// 测试 需要登录并且为admin用户
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [Authorize("Permission")]
        public string $projectname$TrueAdminLogin()
        {
            return "只有登录并且用户是admin才能访问";
        }
    }
}
